package com.guodi.model.controller;

import com.guodi.common.utils.AjaxResult;
import com.guodi.core.boot.ctrl.BaseController;
import com.guodi.model.service.IRedisDictService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @描述: 数据字典查询控制器（临时使用）
 * @作者: 汤厚韬
 * @日期: 2020/12/10
 */
@RestController
@RequestMapping("/SysDictItem")
@Api(value = "API - SysDictItemController", description = "数据字典查询控制器")
public class SysDictItemController extends BaseController {

    @Resource
    IRedisDictService redisDictService;


    @PostMapping("/listByType")
    @ApiOperation(value = " 根据字典类型编码查询字典列表")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "typeCode", value = "字典类型编号", dataType = "string", paramType = "query")
    })
    public AjaxResult listByType(String typeCode){
        return new AjaxResult<>(redisDictService.getItems(typeCode));
    }
}
